package com.clkj.sunhelp.adapter.list;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.clkj.sunhelp.R;
import com.clkj.sunhelp.bean.HelpProjKindItem;

import java.util.List;

/**
 * Created by Administrator on 2017/3/31.
 */

public class ListAdapterForProjKindChoose extends BaseAdapter {


    List<HelpProjKindItem> mJobDealKindList;
    Context mContext;
    LayoutInflater mLayoutInflater;

    int itemHeight;
    int itemWidth;

    public ListAdapterForProjKindChoose(Context context, List<HelpProjKindItem> jobDealKindList) {
        mContext = context;
        mJobDealKindList = jobDealKindList;
        mLayoutInflater = LayoutInflater.from(context);

       /* int actionBarHeight = 0;
        TypedValue tv = new TypedValue();
        if (mContext.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
            actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, mContext.getResources().getDisplayMetrics());
        }

        int statusBarHeight = CommonUtil.getStatusBarHeight(mContext);
        int screenWidth = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
        int screenHeight = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight();

        itemHeight = (screenHeight - actionBarHeight - statusBarHeight - 3) / 4;
        itemWidth = screenWidth / 2;*/
    }

    @Override
    public int getCount() {
        return mJobDealKindList.size();
    }

    @Override
    public Object getItem(int i) {
        return mJobDealKindList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder viewHolder = null;
        if (view == null) {
            view = mLayoutInflater.inflate(R.layout.list_item_proj_kind, null);
            viewHolder = new ViewHolder();
            viewHolder.tvProjKind = (TextView) view.findViewById(R.id.tv_proj_kind);


            view.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) view.getTag();
        }

        viewHolder.tvProjKind.setText(mJobDealKindList.get(i).getItemName());

        return view;
    }


    static class ViewHolder {
        private TextView tvProjKind;




    }
}
